package com.vsii.sample;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Test {
	public static void main(String[] args) throws IOException {
		ReadCSV r = new ReadCSV();
		r.readFile("resources/file.csv");
		Scanner scanner = new Scanner(new InputStreamReader(System.in));
		
        System.out.println("Reading input from console using Scanner in Java ");
        System.out.println("Please enter your input: ");
        // Nhap id, type vao de sua cac thong tin cua sinh vien va nhan vien
        System.out.println("Enter id:");
        int idChange = Integer.parseInt(scanner.nextLine());
        System.out.println("Enter typeInfo:");
        String typeInfo = scanner.nextLine();
        System.out.println("Enter name:");
        String name = scanner.nextLine();
        System.out.println("Enter age:");
        int age = Integer.parseInt(scanner.nextLine());
        System.out.println("Enter address:");
        String address = scanner.nextLine();
        System.out.println("Enter mobile:");
        int mobile = Integer.parseInt(scanner.nextLine());
        // Ghi nguoc lai cac thong tin thay doi ra file CSV
        boolean result = r.ChangeType(idChange,typeInfo, name, age, address, mobile);
        if(result == false){
        	System.out.println("Not found people has id = "+idChange);
        }      
        System.out.println("List after change: ");
		r.print();
        r.write("D:/file.csv");
	}
}
	
